<div class="Pacientes">
    <fieldset>
        <legend>Pesquisa de Paciente</legend>
        <form accept-charset="utf-8" method="post" id="formulario" action="/siscel/pacientes/" onsubmit="javascript:aguarde();">
            <table width="98%" border="0" cellspacing="0" cellpadding="2">

                <tr>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.NM_PAC', array('type' => 'text', 'label' => 'Nome', 'id' => 'NM_PAC', 'class' => 'campoAlfa', 'size' => "30", 'maxlength' => "120", 'required' => 'false')); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.DT_NASC', array('type' => 'text', 'label' => 'Data de Nascimento', 'id' => 'DT_NASC', 'class' => 'campoData', 'size' => "20", 'maxlength' => "14", 'required' => 'false')); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.CD_CID_NAT', array('type' => 'text', 'label' => 'Cidade', 'id' => 'CD_CID_NAT')); ?>
                    </td> 
                    <td  width="15%">
                        <?php echo $this->Form->input('Pesquisar.CD_UF', array('type' => 'text', 'label' => 'UF', 'id' => 'CD_UF', 'class' => 'campoAlfa', 'size' => "30", 'maxlength' => "120", 'required' => 'false')); ?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.NU_CPF_PAC', array('type' => 'text', 'label' => 'CPF', 'id' => 'NU_CPF_PAC', 'class' => 'campoCPF', 'size' => "30", 'maxlength' => "120")); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.DT_SOLIC', array('type' => 'text', 'label' => 'Data da Solicitação', 'id' => 'DT_SOLIC', 'class' => 'campoData', 'size' => "30", 'maxlength' => "120")); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.DT_INIC_ANTI_RETRO', array('type' => 'text', 'label' => '1o Antiretroviral', 'id' => 'DT_INIC_ANTI_RETRO', 'class' => 'campoData', 'size' => "30", 'maxlength' => "120")); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.STATUS', array('type' => 'select', 'label' => 'Status', 'id' => 'STATUS', 'options' => array('' => 'Selecione um item', 'A' => 'Ativo', 'I' => 'Inativo'))); ?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.SEXO', array('type' => 'select', 'label' => 'Sexo', 'id' => 'SEXO', 'options' => array('' => 'Selecione um item', 'M' => 'Masculino', 'F' => 'Feminino'))); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.CASO_AIDS', array('type' => 'select', 'label' => 'Cado de Aids?', 'id' => 'CASO_AIDS', 'options' => array('' => 'Selecione um item', 'S' => 'Sim', 'N' => 'Não'))); ?>
                    </td>
                    <td>
                        <?php echo $this->Form->input('Pesquisar.DT_DIAG', array('type' => 'text', 'label' => 'Data do Diagnóstico', 'id' => 'DT_DIAG', 'class' => 'campoData', 'size' => "30", 'maxlength' => "120")); ?>
                    </td>
                    <td>
                        <input id="bntPesquisar" type="submit" value="Pesquisar"/>
                    </td>
                </tr>

            </table>
        </form>
    </fieldset>
    <div id="tabelaPesquisa">
            <table id="tbResuldado" class="dataTable" border="0" cellspacing="0" cellpadding="0">
                <thead>
                    <th></th>
                </thead>
                <tbody>
        <?php if (isset($Pacientes)) : ?>
            <?php foreach ($Pacientes as $Paciente): ?>
                <tr>
                <td>
                    <div style="width: 100%">
                        <div style="width: 10%;float: left;clear: right;">
                            <a href="/siscel/pacientes/cadastrar/<?php echo h($Paciente['PACIENTE']['CD_PAC']); ?>">
                                <?php
                                    if(!empty($Paciente['PACIENTE']['IM_FOTO'])){
                                        $this->Siscel->foto($Paciente['PACIENTE']['IM_FOTO'], 70, 70);
                                    }else{
                                        echo $this->Html->image('/img/perfil.jpg', array('width' => '70', 'height' => '70', 'label' => null, 'style' => 'border: 0;margin: 4px 8px;'));
                                    }
                                ?>
                            </a>
                        </div>
                        <div style="width: 90%;float: left;">
                            <div style="float: left;clear: right;width: 100%;">
                                <table style="width: 100%;border: 0;" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td><b><a href="/siscel/pacientes/cadastrar/<?php echo $Paciente['PACIENTE']['CD_PAC']; ?>"><?php echo ($Paciente['PACIENTE']['NM_PAC']); ?></a></b></td>
                                        <td>Mãe: <?php echo ($Paciente['PACIENTE']['NM_MAE']); ?></td>
                                        <td>Nascimento: <?php echo date('d/m/Y', strtotime($Paciente['PACIENTE']['DT_NASC'])); ?></td>
                                    </tr>
                                </table>
                            </div>
                            <div style="float: left;clear: right;width: 100%;">
                                <table style="width: 100%;border: 0;" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td>Sexo: <?php echo ($Paciente['PACIENTE']['SEXO'] == 2) ? 'Masculino' : 'Feminino'; ?></td>
                                        <td>Pais: <?php echo ($Paciente['PAIS']['NM_PAIS']); ?></td>
                                        <td>CPF: <?php echo ($Paciente['PACIENTE']['NUM_CPF_PAC']); ?></td>
                                    </tr>
                                </table>
                            </div>
                            <div style="float: left;clear: right;width: 100%;">
                                <table style="width: 100%;border: 0;" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td>Raca: <?php echo ($Paciente['RACA']['DS_RACA']); ?></td>
                                        <td>Email: <?php echo ($Paciente['PACIENTE']['EMAIL']); ?></td>
                                        <td>Etnia: <?php echo ($Paciente['ETNIA']['DS_ETNIA']); ?></td>
                                    </tr>
                                </table>
                            </div>
                        </div>                
            <?php endforeach; ?>
        <?php endif; ?>
            </tbody>
        </table>
    </div>    
</div>